package com.suning.sawp.service.impl.dao.mainpushnew;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.intf.dao.mainpushnew.MainPushQueryDao;
import com.suning.sawp.vo.mainpushnew.MainPushModelVo;
import com.suning.sawp.vo.mainpushnew.MainPushStaffModelVo;
import com.suning.sawp.vo.mainpushnew.MainPushStaffidDetailVo;

@Repository
public class MainPushQueryDaoImpl implements MainPushQueryDao {

    @Resource
    private DalClient dalClient;

    public static final String MAINPUSHQUERY_QUERYMAINPUSH_MODELLISTFORSTORE = "MAINPUSHQUERY.QUERYMAINPUSH_MODELLISTFORSTORE";

    public static final String MAINPUSHQUERY_QUERYMAINPUSH_STOREAMOUNT = "MAINPUSHQUERY.QUERYMAINPUSH_STOREAMOUNT";

    public static final String MAINPUSHQUERY_QUERY_STOREAMOUNT = "MAINPUSHQUERY.QUERY_STOREAMOUNT";

    public static final String MAINPUSHQUERY_QUERYMAINPUSHDETAIL_BYMONTH = "MAINPUSHQUERY.QUERYMAINPUSHDETAIL_BYMONTH";

    public static final String MAINPUSHQUERY_QUERYMAINPUSHDETAIL_BYDAY = "MAINPUSHQUERY.QUERYMAINPUSHDETAIL_BYDAY";

    public static final String MAINPUSHQUERY_QUERYMAINPUSH_FORSTAFF = "MAINPUSHQUERY.QUERYMAINPUSH_FORSTAFF";

    @Override
    public List<MainPushModelVo> queryMainPushModelListForStore(String cateCode, String month, String storeCode) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("cateCode", cateCode);
        params.put("month", month);
        params.put("storeCode", storeCode);
        return dalClient.queryForList(MAINPUSHQUERY_QUERYMAINPUSH_MODELLISTFORSTORE, params, MainPushModelVo.class);
    }

    @Override
    public BigDecimal queryMainPushStoreAmount(String cateCode, String month, String storeCode) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("cateCode", cateCode);
        params.put("month", month);
        params.put("storeCode", storeCode);
        return dalClient.queryForObject(MAINPUSHQUERY_QUERYMAINPUSH_STOREAMOUNT, params, BigDecimal.class);
    }

    @Override
    public BigDecimal queryStoreAmount(String cateCode, String month, String storeCode) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("month", month);
        params.put("storeCode", storeCode);
        params.put("cateCode", cateCode);
        return dalClient.queryForObject(MAINPUSHQUERY_QUERY_STOREAMOUNT, params, BigDecimal.class);
    }

    @Override
    public List<MainPushStaffidDetailVo> queryMainPushDetailByMonth(String modelId, String queryParm, String storeCode,
            String storeTaskId) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("modelId", modelId);
        params.put("month", queryParm);
        params.put("storeCode", storeCode);
        params.put("storeTaskId", storeTaskId);
        return dalClient.queryForList(MAINPUSHQUERY_QUERYMAINPUSHDETAIL_BYMONTH, params, MainPushStaffidDetailVo.class);
    }

    @Override
    public List<MainPushStaffidDetailVo> queryMainPushDetailByDay(String modelId, String queryParm, String storeCode,
            String storeTaskId) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("modelId", modelId);
        params.put("day", queryParm);
        params.put("storeCode", storeCode);
        params.put("storeTaskId", storeTaskId);
        return dalClient.queryForList(MAINPUSHQUERY_QUERYMAINPUSHDETAIL_BYDAY, params, MainPushStaffidDetailVo.class);
    }

    @Override
    public List<MainPushStaffModelVo> queryMainPushForStaff(String cateCode, String month, String storeCode,
            String staffId) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("catecode", cateCode);
        params.put("month", month);
        params.put("storecode", storeCode);
        params.put("staffid", staffId);
        return dalClient.queryForList(MAINPUSHQUERY_QUERYMAINPUSH_FORSTAFF, params, MainPushStaffModelVo.class);
    }

}
